package org.act.BPEL2Automata.graphics.model;

import java.awt.Point;

import org.act.BPEL2Automata.automata.module.State;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.widgets.Display;

/**
 * This class used to draw nodes.It holds all the properties 
 * of State of SubAutomataImp or AutomataImp.
 * 
 * @author baoxiwu<bb@feijiao.info>,ACT,Beihang University
 * @version 0.9.0
 * @since 2010-05-16
 * 
 */
public class State4G{
	/*type definitions,so that we can draw different kinds 
	 * of nodes:start nodes with an arrow that has no source node,
	 * final nodes are a combination of two cycles with same center 
	 * and different radiuses.
	*/
	public static final int STATE4G_TYPE_START = -1;
	public static final int STATE4G_TYPE_FINAL = 0;
	public static final int STATE4G_TYPE_OTHER = 1;
	
	private String id = null;
	private int type = State4G.STATE4G_TYPE_OTHER;
	private Point point = null;
	private State from = null;
	private Color color = Display.getDefault().getSystemColor(SWT.COLOR_BLACK);
	
	
	public State4G(String id,int type,State from){
		this.id = id;
		this.type = type;
		this.from = from;
	}
	
	public State4G(String id,int type,State from,Color color){
		this.id = id;
		this.type = type;
		this.from = from;
		this.color = color;
	}
	
	
	public Color getColor() {
		return color;
	}
	
	public void resetColor(){
		this.color = Display.getDefault().getSystemColor(SWT.COLOR_BLACK);
	}
	
	public void setColor(Color color) {
		this.color = color;
	}

	public State getFrom() {
		return this.from;
	}

	public void setFrom(State from) {
		this.from = from;
	}

	public String getID() {
		return this.id;
	}

	public void setID(String id) {
		this.id = id;
	}

	public int getType() {
		return this.type;
	}

	public void setType(int type) {
		this.type = type;
	}

	public State4G(Point point){
		this.point = point;
	}
	
	public void setPoint(Point point){
		this.point = point;
	}
	
	public Point getPoint(){
		return this.point;
	}
	
	
	public String toString(){
		return "s" + this.getID() + "@" + this.getPoint();
	}
}